import*as e from"../../core/common/common.js";import*as t from"../../core/i18n/i18n.js";import*as o from"../../core/root/root.js";import*as i from"../../core/sdk/sdk.js";import*as r from"../../ui/legacy/legacy.js";let a;const n={memory:"Memory",liveHeapProfile:"Live Heap Profile",startRecordingHeapAllocations:"Start recording heap allocations",stopRecordingHeapAllocations:"Stop recording heap allocations",startRecordingHeapAllocationsAndReload:"Start recording heap allocations and reload the page",startStopRecording:"Start/stop recording",showNativeFunctions:"Show native functions in JS Profile",showMemory:"Show Memory",showLiveHeapProfile:"Show Live Heap Profile"},l=t.i18n.registerUIStrings("panels/profiler/profiler-meta.ts",n),s=t.i18n.getLazilyComputedLocalizedString.bind(void 0,l);async function c(){return a||(a=await import("./profiler.js")),a}r.ViewManager.registerViewExtension({location:"panel",id:"heap_profiler",commandPrompt:s(n.showMemory),title:s(n.memory),order:60,loadView:async()=>(await c()).HeapProfilerPanel.HeapProfilerPanel.instance()}),r.ViewManager.registerViewExtension({location:"drawer-view",id:"live_heap_profile",commandPrompt:s(n.showLiveHeapProfile),title:s(n.liveHeapProfile),persistence:"closeable",order:100,loadView:async()=>(await c()).LiveHeapProfileView.LiveHeapProfileView.instance(),experiment:o.Runtime.ExperimentName.LIVE_HEAP_PROFILE}),r.ActionRegistration.registerActionExtension({actionId:"live-heap-profile.toggle-recording",iconClass:"record-start",toggleable:!0,toggledIconClass:"record-stop",toggleWithRedColor:!0,loadActionDelegate:async()=>(await c()).LiveHeapProfileView.ActionDelegate.instance(),category:r.ActionRegistration.ActionCategory.MEMORY,experiment:o.Runtime.ExperimentName.LIVE_HEAP_PROFILE,options:[{value:!0,title:s(n.startRecordingHeapAllocations)},{value:!1,title:s(n.stopRecordingHeapAllocations)}]}),r.ActionRegistration.registerActionExtension({actionId:"live-heap-profile.start-with-reload",iconClass:"refresh",loadActionDelegate:async()=>(await c()).LiveHeapProfileView.ActionDelegate.instance(),category:r.ActionRegistration.ActionCategory.MEMORY,experiment:o.Runtime.ExperimentName.LIVE_HEAP_PROFILE,title:s(n.startRecordingHeapAllocationsAndReload)}),r.ActionRegistration.registerActionExtension({actionId:"profiler.heap-toggle-recording",category:r.ActionRegistration.ActionCategory.MEMORY,iconClass:"record-start",title:s(n.startStopRecording),toggleable:!0,toggledIconClass:"record-stop",toggleWithRedColor:!0,contextTypes(){return e=e=>[e.HeapProfilerPanel.HeapProfilerPanel],void 0===a?[]:e(a);var e},loadActionDelegate:async()=>(await c()).HeapProfilerPanel.HeapProfilerPanel.instance(),bindings:[{platform:"windows,linux",shortcut:"Ctrl+E"},{platform:"mac",shortcut:"Meta+E"}]}),e.Settings.registerSettingExtension({category:e.Settings.SettingCategory.PERFORMANCE,storageType:e.Settings.SettingStorageType.Synced,title:s(n.showNativeFunctions),settingName:"showNativeFunctionsInJSProfile",settingType:e.Settings.SettingType.BOOLEAN,defaultValue:!0}),r.ContextMenu.registerProvider({contextTypes:()=>[i.RemoteObject.RemoteObject],loadProvider:async()=>(await c()).HeapProfilerPanel.HeapProfilerPanel.instance(),experiment:void 0});
